﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class DiggMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.Digg>
    {
        public DiggMap()
        {
            // table
            //ToTable("CMS_Digg");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.ContentId)
                
                .IsRequired();
            Property(t => t.GoodNum)
                
                .IsRequired();
            Property(t => t.BadNum)
                
                .IsRequired();
            Property(t => t.LastUserName)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.LastDiggDate)
                
                .IsRequired();

            // Relationships
            HasRequired(t => t.Core)
            .WithMany(t => t.Diggs)
            .HasForeignKey(d => d.ContentId);

            //InitializeMapping();
        }
    }
}

